<?php
/**
 * Created by PhpStorm.
 * User: UEWARE
 * Date: 2019-8-28
 * Time: 16:43:54
 */

namespace App\Http\Controllers\WeChat\Diary\V1\User;

use App\Http\Controllers\WeChat\WeChatController;
use App\Models\TravelsModel;
use App\Models\UserModel;

class DetailController extends WeChatController
{
    /**
     * 用户详情
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function index()
    {
        $user = UserModel::query()->where('id', $this->userId)->first()->toArray();
        $user['count_travel'] = TravelsModel::query()
            ->where('user_id', $this->userId)
            ->count();

        return success($user);
    }
}
